﻿
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using Model;


namespace MsDAL
{
    public partial class Pot3a00DAL : Pot3a00Base
    {
        public SqlApp DeleteAllByLeverId(string leverid)
        {
            //删除所有子集别
            string sql = @" UPDATE Pot3a00 SET status = '4' WHERE pvlistid = @listid ";

            SqlParameter[] parameters = {
				new SqlParameter("@listid",SqlDbType.NVarChar)
				};

            parameters[0].Value = leverid;

            return new SqlApp(sql, new ArrayList(parameters), true, "");
        }

        public SqlApp DeleteByBrand(string brandid)
        {
            //根据品牌删除数据
            string sql = @" UPDATE Pot3a00 SET status = '4' WHERE brand = @listid ";

            SqlParameter[] parameters = {
				new SqlParameter("@listid",SqlDbType.NVarChar)
				};

            parameters[0].Value = brandid;

            return new SqlApp(sql, new ArrayList(parameters), true, "");
        }

        public SqlApp UpdateWayQty(string pidId, double qty)
        {
            var sql = "UPDATE Pot3a00 SET outdate = GETDATE(), wayqty = wayqty +  @qty WHERE listid = @pid";

            SqlParameter[] parameters = {
				new SqlParameter("@qty", SqlDbType.Decimal),
				new SqlParameter("@pid", SqlDbType.NVarChar)
				};
            parameters[0].Value = qty;
            parameters[1].Value = pidId;

            return new SqlApp(sql, new ArrayList(parameters), false, "更新商品的在途量失败！");
        }

    }
}
